import java.util.ArrayList;
import java.util.List;


public class ComponentComposite extends Component{

    private List<Component> childrenList = new ArrayList<Component>();

    public ComponentComposite(String nameConponent){
        super(nameConponent);
    }

    @Override
    public boolean addChild(Component child) {
        return this.childrenList.add(child);
    }

    @Override
    public void operation() {
        System.out.println("————————————————————————————————————————————————");
        System.out.println("花果山后勤部："+getNameComponent());
        for(Component currentComponent: childrenList){
            currentComponent.operation();
        }
        System.out.println("————————————————————————————————————————————————");

    }
}
